<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选择产品挂靠公司列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form  id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox">
                <div class="label">挂靠公司名称</div>
                <div class="field">
                    <input name="lnkCompNm" id="lnkCompNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
           <%--  <div class="fieldBox">
                <div class="label">审核状态</div>
                <div class="field">
                     <select name="audStsCd"  id="audStsCd"   data-value="">
                     <option value="  "   selected="selected">--请选择--</option>
                     <c:forEach items="${keyValueList}" var="item">
                     	<option value="${item.key}">${item.value }</option>
                     </c:forEach>
				     </select>
                </div>
            </div> --%>
               
            <div class="formBtns notRight">
               <span id="searchBtn" class="sq-button-round">查询</span>
               <span id="clearBtn" onclick="clearBtn();" class="sq-button-round">清空</span>
               </div>
      	</div>
       </form>
 
</div>
<div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
	var grid = null;
	var prdDtlIds = '${ids}';
	var nonAudStsCd = FlowConstant.FLOW_CHECK_STATE_NO_PASS;
	$(function () {
	    $("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/project/prjlnkcomp/initList.do?nonAudStsCd='+nonAudStsCd,
	    	method : 'get',
	        columns: [
	            { display: '公司名称', name: 'lnkCompNm', minWidth: 60,
	            	 render: function (rowdata, rowindex, value){
		                    var h='';
			                    if(rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_NON||rowdata.audStsCd==FlowConstant.FLOW_CHECK_STATE_IN){
			                    	h+='<i class="ico_flasher"></i>';
			                    }
		                        h+=rowdata.lnkCompNm;
		                    return h;
		                }},
	            { display: '成立日期', name: 'regDt', minWidth: 140 , render:renderDate,enabledSort:true},
	            { display: '企业类型', name: 'compTyp', minWidth: 60},
	            { display: '法人代表', name: 'corpRep', minWidth: 140 },
	            { display: '联系人', name: 'lnkNm', minWidth: 140 },
	            {
	                display: '操作',
	                isSort: false,
	                width: 100,
	                render: function (rowdata, rowindex, value){
	                    var h='<a class="sq-button-hasicon" href="javascript:chooseLnkComp(';
	                        h+="'"+rowdata.id+"',";
	                        h+="'"+rowdata.lnkCompNm+"'";
	                        h+=')"><i class="sqBtnIco_3"></i>选择</a>'
	                    return h;
	                }
	            }
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        //isScroll: false,
	        checkbox:true,
	        rownumbers:true
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	    $("#searchBar").ligerForm();
	
	    $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         data["lnkCompNm"] = $("#lnkCompNm").val();
	         data["audStsCd"] = $("#audStsCd").val();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	});
	function chooseLnkComp(compId,compNm){
		if(compId){
			//更新产品的挂靠公司信息
			parent.window.document.getElementById("lnkCompId").value=compId;
			parent.window.document.getElementById("lnkCompNm").value=compNm;
			parent.$.ligerDialog.close();
			parent.$(".l-dialog,.l-window-mask").css("display","none"); 
		}
	}
	
	//格式化时间
	function renderDate(rowdata, index, value){
		var dateStr = "";
		if(null != value){
			var date = new Date(value);
			dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
		}
		return dateStr;
	}
	function clearBtn(){
		  var form = new liger.get("searchBar");
		form.setData({
			lnkCompNm:" "
		 });
	}
	
	  
</script>

</body>
</html>